package com.dalin.platform.loa.action;

import java.util.ArrayList;
import java.util.List;

import com.dalin.framework.action.StrutsTwoAction;
import com.dalin.platform.etl.condition.EtlDatabaseInfoCondition;
import com.dalin.platform.etl.model.EtlDatabaseInfoEntity;
import com.dalin.platform.loa.vo.WsDicItemVo;
import com.dalin.platform.pub.PlatContext;
/*****************************************************************************
 * @content: 类信息                                                   *
 * @author : 那建林                                                                                                                                 *
 * @crtDate: 2010-06-17                                                     *
 * @modDate: 2010-06-17                                                     *
 * @version: 1.00                                                           *
 ****************************************************************************/
public class DicOthersAction extends StrutsTwoAction{
    private String flag;
    
    public String execute()throws Exception {
        super.printInfo("", "===== this action begin");
        List<WsDicItemVo> rtnList = new ArrayList<WsDicItemVo>();
        WsDicItemVo vo = null;
        if ("database".equals(flag)) {
        	EtlDatabaseInfoCondition cond = new EtlDatabaseInfoCondition();
	        List<EtlDatabaseInfoEntity> entyList = PlatContext.getDao()
	        		.queryObjsToPages(cond.prepareParams().getPreparedPageQuery());
	        for (EtlDatabaseInfoEntity enty : entyList) {
	        	vo = new WsDicItemVo(enty
	        			.getDatabaseId().toString(), 
	        			enty.getDatabaseName()+":"+enty.getUserName());
	        	rtnList.add(vo);
	        }
	    }
        
        
        
//        if ("project".equals(flag)) {
//        	LoaProjectCondition cond = new LoaProjectCondition();
//            List<LoaProjectEntity> entyList = loaService.queryListByCond(cond.prepareParams());
//            for (LoaProjectEntity enty : entyList) {
//            	vo = new WsDicItemVo(Integer.parseInt(enty
//            			.getProjectId().toString()), enty.getProjectName());
//            	rtnList.add(vo);
//            }
//        } 
//        else if ("user".equals(flag)) {
//        	LoaUserCondition cond = new LoaUserCondition();
//        	cond.setProjectId(getCurrentUser().getProjectId());
//        	List<LoaUserEntity> entyList = loaService
//        			.queryListByCond(cond.prepareParams());
//        	 for (LoaUserEntity enty : entyList) {
//             	vo = new WsDicItemVo(Integer.parseInt(enty
//             			.getUserId().toString()), enty
//             					.getLoaEmployeeEntity().getRealName());
//             	rtnList.add(vo);
//             }
//        } else if ("employee".equals(flag)) {
//        	LoaEmployeeCondition cond = new LoaEmployeeCondition();
//        	List<LoaEmployeeEntity> entyList = loaService
//        			.queryListByCond(cond.prepareParams());
//        	 for (LoaEmployeeEntity enty : entyList) {
//             	vo = new WsDicItemVo(Integer.parseInt(enty
//             			.getEmployeeId().toString()), enty.getRealName());
//             	rtnList.add(vo);
//             }
//        }
        setRootResContent(rtnList);
        super.printInfo("", "===== this action end");
        return null;

    }

	public String getFlag() {
		return flag;
	}

	public void setFlag(String flag) {
		this.flag = flag;
	}
}
